package final_curso;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

public class CpanelAnimacion extends JPanel{
	static int PosX,PosY,Vel,ancho,alto;
	CpanelBolita pb=new CpanelBolita();
	Principal p;
	public CpanelAnimacion() {
		super();
		this.setVisible(true);
		this.setBackground(new Color(180,120,90));
		asignar();
		
	}
	private void asignar() {
		PosX=80;		
		PosY=80;
		Vel=2;
		ancho=2;
		alto=15;		
		
		
	}
	public void paint(Graphics g){
		super.paint(g);
		g.fillRect(PosX,PosY,ancho,alto);
		g.setColor(Color.black);
		
	}
	public void MoverBala(){
		
		if(PosY>this.getHeight()-alto || PosY<0)//getHeight (alto)
			Vel*=-1;
		
		PosY+=Vel;

	}

}
